Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Path To

The Path To command allows you to get the pathname, in the form of either an alias or a string, of some of the standard folders on a startup disk. It also allows you to get the location on disk of the frontmost application.

Path To is one of several commands provided by the File Commands
scripting addition.

SYNTAX
path to folderOrApplication [ as className ]
PARAMETERS
folderOrApplication

One of these constants:
apple menu
apple menu items
control panels
desktop
extensions
preferences
printmonitor
printmonitor documents
trash
startup items
system folder
temporary items
startup disk
frontmost application

className
The class identifier string. If you omit this parameter, the pathname is returned as an alias.
RESULT
An alias by default, or a string if you include the optional as string parameter.

EXAMPLES
path to control panels
--result: alias "Hard Disk:System Folder:Control Panels:"

tell application "Scriptable Text Editor" set x to path to it as string end tell --result: "Hard Disk:Scriptable Text Editor"

tell application "Scriptable Text Editor" activate tell application "HyperCard" to activate set x to path to frontmost application end tell return x --result: alias "Hard Disk:Applications:HyperCard"

NOTES
The optional as parameter is useful if you send the Path To command to an application on a remote computer. If the pathname is returned as a string, you can use the form file nameString to identify the folder or application across the network, and Path To won't actually attempt to locate it until you run the script. If the pathname is returned as an alias and you use it to refer to the folder or application elsewhere in the script, Path To also attempts to locate
the file whenever you modify the script and then attempt to check its syntax
or save it, requiring appropriate access privileges and possibly a password each time.

ERRORS
Error
number
Error message
-50Parameter error.
-108Out of memory.
-1700Can't make some data into the expected type.
-1701Some parameter is missing for <commandName>.
-1704Some parameter was invalid.
-1705Operation involving a list item failed.
-1708<reference> doesn't understand the <commandName> message.
-1718Reply has not yet arrived.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996